package com.xiaofu.datasource.controller;

import com.xiaofu.datasource.po.UserPO;
import com.xiaofu.datasource.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author luofuzhou
 * @date 2024/8/23
 * @dec 描述
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/getUserInfo")
    public List<UserPO> hello() {
        return userService.getUserInfo();
    }

    @GetMapping("/insert/{sno}")
    public UserPO insert(@PathVariable String sno) {
        UserPO userPO = new UserPO();
        userPO.setPassword("2323");
        userPO.setPhone("2w32323");
        userPO.setUsername("sno-" + sno);
        if ("1".equals(sno)) {
            return userService.insertM1(userPO);
        } else {
            return userService.insertM2(userPO);
        }

    }
}
